package com.winchain.chainbill.bill.biz.transfer.service.impl;

import com.shell.bee.base.utils.StringUtil;
import com.shell.bee.persistence.annotation.Pagination;
import com.shell.bee.persistence.model.PageLimit;
import com.shell.framework.utils.CommonDataUtil;
import com.winchain.chainbill.bill.base.dao.CbRecDao;
import com.winchain.chainbill.bill.base.po.CbXfe;
import com.winchain.chainbill.bill.base.service.CbXfeService;
import com.winchain.chainbill.bill.biz.query.vo.CbRecQueryVo;
import com.winchain.chainbill.bill.biz.query.vo.CbRecVo;
import com.winchain.chainbill.bill.biz.transfer.service.BillXfeQueryService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("billXfeQueryService")
public class BillXfeQueryServiceImpl implements BillXfeQueryService {
	@Autowired
	CbRecDao cbRecordDao;
	@Autowired
	CbXfeService cbXfeService;

	@Pagination
	public List<CbRecVo> selectBillForXfeReviewByPage(PageLimit limit, CbRecQueryVo recordQueryVo) {
		recordQueryVo.setHldrId(CommonDataUtil.getCurEntId());
		if (StringUtil.notEmpty(recordQueryVo.getBillCode())) {
			recordQueryVo.setBillCode(StringUtil.getParameterLike(recordQueryVo.getBillCode()));
		}
		String[] billStates = { "S006", "S026" };

		recordQueryVo.setBillStates(billStates);
		return this.cbRecordDao.selectOwnBill(recordQueryVo);
	}

	public List<CbXfe> selectTransferByPrntId(String prntId) {
		CbXfe transfer = new CbXfe();
		transfer.setPrntId(prntId);
		transfer.setXfeState("1");
		return this.cbXfeService.selectByEntity(transfer);
	}
}
